<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->


<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-cn" xml:lang="zh-cn">
<head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="DC.Type" content="topic">
<meta name="DC.Title" content="Oracle数据库">
<meta name="product" content="">
<meta name="DC.Relation" scheme="URI" content="zh-cn_topic_0000001839267033.html">
<meta name="prodname" content="">
<meta name="version" content="">
<meta name="brand" content="30-OceanProtect 备份一体机 1.5.0-1.6.0 帮助中心">
<meta name="DC.Publisher" content="20240320">
<meta name="DC.Format" content="XHTML">
<meta name="DC.Identifier" content="ZH-CN_TOPIC_0000001792387980">
<meta name="DC.Language" content="zh-cn">
<link rel="stylesheet" type="text/css" href="public_sys-resources/commonltr.css">
<title>Oracle数据库</title>
</head>
<body style="clear:both; padding-left:10px; padding-top:5px; padding-right:5px; padding-bottom:5px"><a name="ZH-CN_TOPIC_0000001792387980"></a><a name="ZH-CN_TOPIC_0000001792387980"></a>

<h1 class="topictitle1">Oracle数据库</h1>
<div><div class="section" id="ZH-CN_TOPIC_0000001792387980__section4543102195920"><a name="ZH-CN_TOPIC_0000001792387980__section4543102195920"></a><a name="section4543102195920"></a><h4 class="sectiontitle">pre-freeze-script脚本</h4><p>脚本内容如下：</p>
<pre class="screen">#!/bin/sh
ORACLE_HOME=<em><strong>Oracle数据库安装路径</strong></em>
FREEZEFILE=$ORACLE_HOME"/DBA_SCRIPTS/pre-freeze.sql"
FREEZELOG=$ORACLE_HOME"/DBA_SCRIPTS/pre-freeze.log"
if [ "$(id -u)" -eq "0" ]; then 
    echo "$ORACLE_HOME/bin/sqlplus 'sys/sys@KPNDB as sysdba' &lt;&lt;EOF" &gt; ${FREEZEFILE}
    echo "spool ${FREEZELOG};" &gt;&gt; ${FREEZEFILE}
    echo "alter database begin backup;" &gt;&gt; ${FREEZEFILE}
    echo "spool off;" &gt;&gt; ${FREEZEFILE}
    echo "EOF" &gt;&gt; ${FREEZEFILE}
    exec su oracle -c  ${FREEZEFILE}
    [ -f ${ FREEZELOG } ] &amp;&amp; rm -f ${ FREEZELOG }
fi</pre>
</div>
<div class="section" id="ZH-CN_TOPIC_0000001792387980__section655719346595"><a name="ZH-CN_TOPIC_0000001792387980__section655719346595"></a><a name="section655719346595"></a><h4 class="sectiontitle">post-thaw-script脚本</h4><p>脚本内容如下：</p>
<pre class="screen">#!/bin/sh
ORACLE_HOME=<em><strong>Oracle数据库安装路径</strong></em>
UNFREEZEFILE=$ORACLE_HOME"/DBA_SCRIPTS/post-thaw.sql"
UNFREEZELOG=$ORACLE_HOME"/DBA_SCRIPTS/post-thaw.log"
if [ "$(id -u)" -eq "0" ]; then 
    echo "$ORACLE_HOME/bin/sqlplus 'sys/sys@KPNDB as sysdba' &lt;&lt;EOF" &gt; ${UNFREEZEFILE}
    echo "spool ${UNFREEZELOG};" &gt;&gt; ${UNFREEZEFILE}
    echo "alter database end backup;" &gt;&gt; ${UNFREEZEFILE}
    echo "spool off;" &gt;&gt; ${UNFREEZEFILE}
    echo "EOF" &gt;&gt; ${UNFREEZEFILE}
    exec su oracle -c  ${UNFREEZEFILE}
    [ -f ${UNFREEZEFILE} ] &amp;&amp; rm -f ${UNFREEZEFILE}
fi</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>父主题：</strong> <a href="zh-cn_topic_0000001839267033.html">步骤3：配置应用一致性备份脚本</a></div>
</div>
</div>

<div class="hrcopyright"><hr size="2"></div><div class="hwcopyright">版权所有 &copy; 华为技术有限公司</div></body>
</html>